package com.management.department.teacherinfosystem.Repository;

import com.management.department.teacherinfosystem.Entity.TheoryStudy;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Date;
import java.util.List;

public interface TheoryStudyRepository extends JpaRepository<TheoryStudy, Long> {
	List<TheoryStudy> findByUserId(@Param("userId") Long userId);
	@Query("select t from TheoryStudy t where (:start is null or t.studyDate >= :start) and (:end is null or t.studyDate <= :end) order by t.studyDate desc, t.createdAt desc")
	List<TheoryStudy> findByDateRange(@Param("start") Date start, @Param("end") Date end);

	List<TheoryStudy> findByStatus(@Param("status") String status);
} 